<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@include file="/context/mytags.jsp" %>
<div id="main_typegroup_list" class="easyui-layout" fit="true">
  <div region="center" style="padding: 1px;">
    <t:datagrid name="commentDatagridlList" title=""  fitColumns="false" actionUrl="questionsController.do?commentDatagrid&quesId=${quesId}" fit="true" idField="commentId"
                queryMode="group" onLoadSuccess="loadSuccess" sortOrder="desc" sortName="createTime">
      <t:dgCol title="id" field="commentId" hidden="true"></t:dgCol>
      <%--<t:dgCol title="资产名称"   field="assetInfo.name" sortable="false" query="true" ></t:dgCol>--%>
      <t:dgCol title="回答人"   field="consumer.nickname" ></t:dgCol>
      <t:dgCol title="回答时间"  formatter="yyyy-MM-dd hh:mm:ss" field="createTime"></t:dgCol>
      <t:dgCol title="问答内容"  field="content"  extendParams="formatter:f_substring;"  ></t:dgCol>
      <t:dgCol title="回复数"   field="replyNum"  ></t:dgCol>

      <t:dgCol title="common.operation" field="opt" ></t:dgCol>
      <t:dgFunOpt title="回复详情" exp="replyNum#ne#0" funname="f_openDetail(commentId)"></t:dgFunOpt>

      <%--<t:dgDelOpt url="applyAssetController.do?applyAssetDetailDel&id={detailId}" title="删除" operationCode="delOperation"></t:dgDelOpt>--%>

      <%--<t:dgToolBar title="修改" operationCode="editOperation" langArg="common.user" icon="icon-edit" url="applyAssetController.do?applyAssetDetailAddorupdate" width="380" height="200" funname="f_updateApplyAssetDetail"></t:dgToolBar>--%>
    </t:datagrid>
  </div>
</div>


<script type="text/javascript">

  $(function() {
  });

  /**
   * 重写 更新事件打开窗口
   * @param title 编辑框标题
   * @param addurl//目标页面地址
   * @param id//主键字段
   */
  function f_openDetail(title,url, id,width,height) {
    gridname=id;
    var rowsData = $('#'+id).datagrid('getSelections');
    if (!rowsData || rowsData.length==0) {
      tip('请选择编辑项目');
      return;
    }
    if (rowsData.length>1) {
      tip('请选择一条记录再编辑');
      return;
    }

    url += '&detailId='+rowsData[0].detailId;
    createwindow(title,url,width,height);
  }

  function f_openDetail(commentId){
    var rowsData = $('#commentDatagridlList').datagrid('getSelections');

    setTimeout(function(){
      var title = rowsData[0]['consumer.nickname'] + '的回复详情';

      if(title.length > 23){
        title = title.substring(0,23) + "...";
      }

      $.dialog.setting.zIndex = 1900;
      createwindow(title,"questionsController.do?parentCommentList&commentId=" + commentId,600,400);
    },10);

  }



  function loadSuccess() {


  }


</script>
